package com.gzlww.tset;

import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class TankClient extends Frame{
	
	int x =50,y=50;
	
	public void paint(Graphics g){
		Color c = g.getColor();
		g.setColor(Color.red);
		g.fillOval(x, y, 30, 30);
		g.setColor(c);
		
		y += 5;
	}

	public void lauchFrame(){
		this.setLocation(250,100);
		this.setSize(800, 600);
		this.setTitle("Tank War");
		this.addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
	});
		this.setResizable(false);
		this.setBackground(Color.GREEN); 
		this.setVisible(true);	
		
		new Thread(new PaintThread()).start();
	}
	
	public static void main(String[] args) {
		TankClient tc = new TankClient();
		tc.lauchFrame();
//		PaintThread pt = new PaintThread();
		
	}
	public class PaintThread implements Runnable{

		@Override
		public void run() {
			while(true){
				repaint();
				try {
					Thread.sleep(50);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		}
		
	}
}
